#include<iostream>
using namespace std;

int bin_minabs(){
    const static int len = 5;
    int a[len] = {-5,-3,-1,2,8};
    int left,right,mid;
    left=0,right=len-1;
    while(left<right){
        mid = (left+right)>>1;
        if(a[mid]==0)
            return 0;
         else if(a[mid]>0 && a[left]<0){
            right = mid - 1;
        }else if(a[mid]<0 && a[right]>0){
            left = mid + 1;
        }else
            return -1;
    }
    return mid;
}

int main(){
    printf("%d",bin_minabs());
    return 0;
}
